package us.team.openAnAppAtRandom.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 应用清单模型类
 */
public class AppList implements Serializable {
    private String name; // 清单名称
    private List<AppItem> apps; // 应用列表
    
    public AppList(String name) {
        this.name = name;
        this.apps = new ArrayList<>();
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public List<AppItem> getApps() {
        return apps;
    }
    
    public void setApps(List<AppItem> apps) {
        this.apps = apps;
    }
    
    public void addApp(AppItem app) {
        this.apps.add(app);
    }
    
    public void removeApp(int position) {
        if (position >= 0 && position < apps.size()) {
            this.apps.remove(position);
        }
    }
    
    public int size() {
        return apps.size();
    }
}